@extends('common.layout')

@section('title', '添加')

@section('body')
<body>
    <form class="layui-form" action="/admin/menu/{{isset($row) ? 'edit' : 'add'}}">
        <div class="mainBox">
            <div class="main-container">
                <div class="main-container">

                    @include('common.component.form.select', ['title' => '菜单类型', 'list' => $typeList, 'name' => 'form[type]', 'value' => $row->type ?? 'menu'])

                    @isset($row)
                        <input type="hidden" name="form[id]" value="{{$row->id}}">
                    @endisset

                    <div class="layui-form-item">
                        <label class="layui-form-label">父级菜单</label>
                        <div class="layui-input-block">
                            <ul id="form-pid" class="dtree" data-value="{{$pid ?? 0}}"></ul>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">规则</label>
                        <div class="layui-input-block">
                            <input type="text" name="form[rule]" lay-verify="require" autocomplete="off" placeholder="规则" class="layui-input" value="{{$row->rule ?? ''}}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">标题</label>
                        <div class="layui-input-block">
                            <input type="text"  name="form[title]" lay-verify="require" autocomplete="off" placeholder="标题" class="layui-input" value="{{$row->title ?? ''}}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">图标</label>
                        <div class="layui-input-block">
                            <input type="text" id="form-icon" lay-filter="iconPicker2" name="form[icon]" class="layui-input" value="{{$row->icon ?? ''}}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">额外参数</label>
                        <div class="layui-input-block">
                            <input type="text" name="form[condition]" placeholder="额外参数" class="layui-input" value="{{$row->condition ?? ''}}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <input type="text"  name="form[remark]" placeholder="remark" class="layui-input" value="{{$row->remark ?? ''}}">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">权重</label>
                        <div class="layui-input-block">
                            <input type="text"  name="form[weigh]" placeholder="weigh" class="layui-input" value="{{$row->weigh ?? 1000}}">
                        </div>
                    </div>

                    @include('common.component.form.select', ['title' => '状态', 'list' => $statusList, 'name' => 'form[status]', 'value' => $row->status ?? 'normal'])

                    @include('common.component.form.select', ['title' => '打开方式', 'list' => $targetList, 'name' => 'form[target]', 'value' => $row->target ?? '_iframe'])
                </div>
            </div>
        </div>
        <div class="bottom">
            <div class="button-container">
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                    <i class="layui-icon layui-icon-ok"></i>
                    提交
                </button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </div>
    </form>
@parent
</body>
@endsection

